package cn.itcast.demo.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @Author: taft
 * @Date: 2018-12-6 10:41
 */
@Configuration
//@EnableConfigurationProperties(JdbcProperties.class)
public class JdbcConfigSpringBoot {

//    @Autowired
//    private JdbcProperties jdbcProps;

    @Bean
    @ConfigurationProperties(prefix = "jdbc")
    public DataSource dataSource(){
        DruidDataSource dataSource = new DruidDataSource();
        return dataSource;
    }
}
